package cn.yedong.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 工具类：封装增删改的返回结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    private Boolean success = true;
    private String  msg = "操作成功";
    //向前端传递任意类型对象，fastDfs
    private Object obj;

    public AjaxResult(Boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }

    //改造链式语法：当点击AjaxResult.me 时返回当前对象
    public static AjaxResult me(){
        return new AjaxResult();
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public AjaxResult setObj(Object obj) {
        this.obj = obj;
        return this;
    }
}
